using UnityEngine;
using System.Collections;

public class CharacterManager : MonoBehaviour 
{
	public bool specialCube;
	public CharacterFunctions[] initializeFunctions;
	
	private CharacterDrop characterDrop;
	private CharacterMovement characterMovement;
	private CharacterKill characterKill;
	private CharacterCollision characterCollision;
	private ColorManager colorManager;
	
	void Start()
	{
		specialCube = false;
		
		characterDrop = gameObject.GetComponent<CharacterDrop>();
		characterMovement = gameObject.GetComponent<CharacterMovement>();
		characterCollision = gameObject.GetComponent<CharacterCollision>();
		colorManager = gameObject.GetComponent<ColorManager>();
		characterKill = gameObject.GetComponent<CharacterKill>();
		
		foreach(CharacterFunctions type in initializeFunctions)
		{
			ActiveElement(type);	
		}
		
	}
	
	public void DeactiveAll()
	{
		characterDrop.enabled = false;
		characterMovement.enabled = false;
		characterCollision.enabled = false;
		colorManager.enabled = false;
	}
	
	public void reactiveAll()
	{
		characterDrop.enabled = true;
		characterMovement.enabled = true;
		characterCollision.enabled = true;
		colorManager.enabled = true;
	}
	
	public void ActiveElement(CharacterFunctions functions)
	{
		switch (functions)
		{
			case CharacterFunctions.DROP:
				characterDrop.enabled = true;
				break;	
			
			case CharacterFunctions.MOVEMENT:
				characterMovement.enabled = true;
				break;	
			
			case CharacterFunctions.CHARACTERCOLLISION:
				characterCollision.enabled = true;
				break;	
		}
	}
	
	public ColorManager getColorManager()
	{
		return colorManager;
	}
	
	public void KillCharacter(int num)
	{
		characterKill.Initialize(num);
	}
	
	public enum CharacterFunctions
	{
		MOVEMENT,
		DROP,
		CHARACTERCOLLISION
	}
	
}
